package com.asset.salesforce.model;
import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.asset.salesforce.jacksonConvertor.CustomDateSerializer;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@SuppressWarnings("serial")
@Entity
@Table(name="call")
@JsonRootName(value="calls")
public class Call implements Serializable {
	@JsonInclude(Include.NON_NULL)
	private Integer id;
	@JsonIgnore
	 private Employee crmStaff;
	@JsonInclude(Include.NON_NULL)
	  
	private Integer crmStaffId;
	@JsonIgnore
	 private Contact contactedPerson;
	@JsonInclude(Include.NON_NULL)
	  
	private String crmStaffName;
	  
	@JsonInclude(Include.NON_NULL)
	private String ownerName;
	@JsonInclude(Include.NON_NULL)
	  
	private String contactedPersonName;
	@JsonInclude(Include.NON_NULL)
	  
	 private Integer contactedPersonId;
	 @JsonInclude(Include.NON_NULL)
	 private Date date;
	 @JsonInclude(Include.NON_NULL)
	 private Boolean inOutCall;
	 @JsonInclude(Include.NON_NULL)
	 private Boolean decisionMaker;
	 @JsonInclude(Include.NON_NULL)
	 private String comment;
	 @JsonInclude(Include.NON_NULL)
	 private Boolean nextFollowUp;
	 @JsonInclude(Include.NON_NULL)
	 private String followUpType;
	 @JsonInclude(Include.NON_NULL)
	 private String followUpDetails;
	 @JsonInclude(Include.NON_NULL)
	 private Date followUpDate;
	 @JsonInclude(Include.NON_NULL)
	 private Integer parentId;
	 @JsonInclude(Include.NON_NULL)
	 private String parentType;
	 @JsonInclude(Include.NON_NULL)
	 private String startTime;
	 @JsonInclude(Include.NON_NULL)
	 private String endTime;
	 @JsonInclude(Include.NON_NULL)
	 private Date dateCreated;
	 @JsonInclude(Include.NON_NULL)
	 private Date dateModified;
	 
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="call_id_seq")
	@SequenceGenerator(name="call_id_seq",sequenceName="call_id_seq",allocationSize=1)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="crm_staff_id")
	public Employee getCrmStaff() {
		return crmStaff;
	}
	public void setCrmStaff(Employee crmStaff) {
		this.crmStaff = crmStaff;
	}
	
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="contacted_person_id")
	public Contact getContactedPerson() {
		return contactedPerson;
	}
	public void setContactedPerson(Contact contactedPerson) {
		this.contactedPerson = contactedPerson;
	}
	
	@Column(name="date")
	@JsonSerialize(using= CustomDateSerializer.class)
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	
	@Column(name="in_out_call")
	public Boolean getInOutCall() {
		return inOutCall;
	}
	public void setInOutCall(Boolean inOutCall) {
		this.inOutCall = inOutCall;
	}
	
	@Column(name="decision_maker")
	public Boolean getDecisionMaker() {
		return decisionMaker;
	}
	public void setDecisionMaker(Boolean decisionMaker) {
		this.decisionMaker = decisionMaker;
	}

	@Column(name="comment")
	public String getComment() {
		return comment;
	}
	/**
	 * @return the crmStaffName
	 */
	@Transient
	public String getCrmStaffName() {
		return crmStaffName;
	}

	/**
	 * @param crmStaffName the crmStaffName to set
	 */
	public void setCrmStaffName(String crmStaffName) {
		this.crmStaffName = crmStaffName;
	}

	/**
	 * @return the contactedPersonName
	 */
	@Transient
	public String getContactedPersonName() {
		return contactedPersonName;
	}

	/**
	 * @param contactedPersonName the contactedPersonName to set
	 */
	public void setContactedPersonName(String contactedPersonName) {
		this.contactedPersonName = contactedPersonName;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}
	
	@Column(name="next_follow_up")
	public Boolean getNextFollowUp() {
		return nextFollowUp;
	}
	public void setNextFollowUp(Boolean nextFollowUp) {
		this.nextFollowUp = nextFollowUp;
	}
	
	@Column(name="follow_up_type")
	public String getFollowUpType() {
		return followUpType;
	}
	public void setFollowUpType(String followUpType) {
		this.followUpType = followUpType;
	}
	
	@Column(name="follow_up_details")
	public String getFollowUpDetails() {
		return followUpDetails;
	}
	public void setFollowUpDetails(String followUpDetails) {
		this.followUpDetails = followUpDetails;
	}
	
	@Column(name="follow_up_date")
	@JsonSerialize(using= CustomDateSerializer.class)
	public Date getFollowUpDate() {
		return followUpDate;
	}
	public void setFollowUpDate(Date followUpDate) {
		this.followUpDate = followUpDate;
	}

	@Column(name="parent_id")
	public Integer getParentId() {
		return parentId;
	}
	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}

	@Column(name="parent_type")
	public String getParentType() {
		return parentType;
	}
	public void setParentType(String parentType) {
		this.parentType = parentType;
	}

	/**
	 * @return the startTime
	 */
	@Column(name="start_time")
	public String getStartTime() {
		return startTime;
	}

	/**
	 * @param startTime the startTime to set
	 */
	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	/**
	 * @return the endTime
	 */
	@Column(name="end_time")
	public String getEndTime() {
		return endTime;
	}

	/**
	 * @param endTime the endTime to set
	 */
	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}
	/**
	 * @return the dateCreated
	 */
	@Temporal(value = TemporalType.TIMESTAMP)
	@Column(name="date_created")
	@JsonSerialize(using= CustomDateSerializer.class)
	public Date getDateCreated() {
		return dateCreated;
	}
	/**
	 * @param dateCreated the dateCreated to set
	 */
	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}
	/**
	 * @return the dateModified
	 */
	@Temporal(value = TemporalType.TIMESTAMP)
	@Column(name="date_modified")
	@JsonSerialize(using= CustomDateSerializer.class)
	public Date getDateModified() {
		return dateModified;
	}
	/**
	 * @param dateModified the dateModified to set
	 */
	public void setDateModified(Date dateModified) {
		this.dateModified = dateModified;
	}
	
	/**
	 * @return the crmStaffId
	 */
	@Transient
	public Integer getCrmStaffId() {
		return crmStaffId;
	}

	/**
	 * @param crmStaffId the crmStaffId to set
	 */
	public void setCrmStaffId(Integer crmStaffId) {
		this.crmStaffId = crmStaffId;
	}

	/**
	 * @return the contactedPersonId
	 */
	@Transient
	public Integer getContactedPersonId() {
		return contactedPersonId;
	}

	/**
	 * @param contactedPersonId the contactedPersonId to set
	 */
	public void setContactedPersonId(Integer contactedPersonId) {
		this.contactedPersonId = contactedPersonId;
	}

	/**
	 * @return the ownerName
	 */
	@Transient
	public String getOwnerName() {
		return ownerName;
	}

	/**
	 * @param ownerName the ownerName to set
	 */
	public void setOwnerName(String ownerName) {
		this.ownerName = ownerName;
	}

}
